<?php
	/**
	* @File name:	catch.php
	* @Desription:	description
	* @Author:	 	jinxin<alucard.jx@gmail.com>   
	* @Date:	 	Mon Sep 05 11:21:46 CST 2011
	* @Copyright 	Copytright (c) jinxin<alucard.jx@gmail.com>
	* @version	 	$Id $
	*/
	
	class admin_animine_controller_catch extends controller {
		public $o;
		public function __construct($app,$controller,$site){
			parent::__construct($app,$controller,$site);
			$this->o = model::factory('admin_animine_model_catches','catch');
			$catchConfFile = DOCUMENT_PATH.DIRECTORY_SEPARATOR.'data_cache'.DIRECTORY_SEPARATOR.'catch.conf.php';
			if (is_file($catchConfFile)) {
				include_once($catchConfFile);
			}
		}
		
		public function regex(){}
		public function catches(){}
		
		public function subCatch(){
			$catchType = array(
				'tudou',
				'youku',
				'sina',
				'6cn',
				'qq',
			);
			$url = $_POST['url'];
			$title =trim($_POST['title']);
			$type = $_POST['type'];
			if (!in_array($type,$catchType)) {
				$this->hint('wrong catch websites','wrong',$_SERVER['REQUEST_URI']);
			}else {
				$v = $this->o->catching($type,$url,$title);
				$this->dump($v);exit;
			}
		}
		
		public function catchList(){
			$page = isset($_GET['page']) &&  (int)$_GET['page'] > 0 ? (int)$_GET['page'] : 1;
			$pagesize = 50;
			$data = $this->o->getCatchList($page,$pagesize);
			$this->attr['list'] = $data['rows'];
			$this->attr['pageInfo'] = $this->genPage($data['pageInfo']);
		}
		public function videoList(){}
	}